/*
  store 模块：集中式管理状态数据

  创建store对象，并暴露：
    {
      getState, 读取数据方法
      dispatch, 触发更新流程（reducer -> 更新store -> 重新渲染）
      subscribe 监听状态变化，执行回调函数
    }
*/

import { createStore, applyMiddleware } from "redux";
// https://github.com/reduxjs/redux-thunk
import { thunk } from "redux-thunk";
import reducer from "./reducer";

// applyMiddleware(thunk) 应用异步中间件：能在redux执行异步操作
const store = createStore(reducer, applyMiddleware(thunk));

export default store;
